const DEFAULT_FILTERS = {
  distId: '',
  comName: '',
  comNumber: '',
  zzTypeId: '0',
  isNeedPhone: '-1',
  // activeType: '0',
  zzName: '',
  isUnlock: '-1',
  comLockStatus: '0',
  comBusinessScope:'',
  sortFieldId: '4',
  sortType: '1'
}

const REGION = {
  province: '',
  city: '',
  area: ''
}

export default {
  namespaced: true,
  state: {
    filters: DEFAULT_FILTERS,
    region: REGION
  },
  getters: {
    getName(state) {
      return state.name
    },
    getFilters(state) {
      return state.filters
    },
    getRegion(state) {
      return state.region
    }
  },
  mutations: {
    setFilters(state, filters) {
      state.filters = filters
    },
    resetFilters(state) {
      state.filters = {
        distId: '',
        comName: '',
        comNumber: '',
        zzTypeId: '0',
        isNeedPhone: '-1',
        // activeType: '0',
        zzName: '',
        endDateId: '',
        isUnlock: '-1',
        comLockStatus: '-1',
        comBusinessScope:'',
        sortFieldId: '4',
        sortType: '1'
      }
    },
    setRegion(state, region) {
      state.region = region
    },
    resetRegion(state) {
      state.region = {
        province: '',
        city: '',
        area: ''
      }
    }
  },
  actions: {
    setFilters({ commit }, filters) {
      commit('setFilters', filters)
    },
    resetFilters({ commit }) {
      commit('resetFilters')
    },
    setRegion({ commit }, filters) {
      commit('setRegion', filters)
    },
    resetRegion({ commit }) {
      commit('resetRegion')
    }
  }
}
